<?php
class CommentsForm extends BaseProductCommentForm
{
	public function configure() {
	  $this->useFields(array( 'product_id', 'name', 'message', 'ip', 'host', 'user_id' ));
          $this->widgetSchema['captcha']= new sfWidgetFormInput(array(), array('title'=> 'Enter code' ));
          $this->widgetSchema['message']= new sfWidgetFormTextarea (array(), array('title' => 'Comment'));
          $this->widgetSchema['ip']= new sfWidgetFormInputHidden();
          $this->widgetSchema['host']= new sfWidgetFormInputHidden();
          $this->widgetSchema['product_id']= new sfWidgetFormInputHidden();
          $this->widgetSchema['rating']= new sfWidgetFormInput();
	  $this->validatorSchema['message'] =  new sfValidatorString(array('required' => true), array('required' => 'Message is required :)'));	  
          $this->validatorSchema['captcha'] =  new sfCaptchaGDValidator(array('length' => 4), array('length' => 'Wrong captcha', 'invalid' => 'wronggg'));
	  $this->validatorSchema['rating'] =  new sfValidatorInteger(array('required' => false, 'max' => 5, 'min' => 0 ), array());

	  $this->setDefault('message', 'Comment');
	  $this->setDefault('name', 'Name');
	  $this->setDefault('captcha', 'Enter code');

	}

} 